package com.ftg.shopping.userGroupPrivilege.controller;

import com.ftg.shopping.config.LayuiPage;
import com.ftg.shopping.sp_deptinfo.entity.Sp_deptinfo;
import com.ftg.shopping.userGroupPrivilege.entity.sp_roleinfo;
import com.ftg.shopping.userGroupPrivilege.service.UserGroupPrivilegeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


@Api(description = "部门维护")
@RestController
@RequestMapping("/api/UGP")
public class UserGroupPrivilegeController {

    @Autowired
    UserGroupPrivilegeService userGroupPrivilegeService;

    @ApiOperation("注解开发显示全部")
    @GetMapping("/showall")
    public LayuiPage<Sp_deptinfo> selectall(int page , int limit , String search){
        return userGroupPrivilegeService.selectall(page,limit,search);
    }

    @ApiOperation("显示")
    @GetMapping("/role2")
    public LayuiPage<sp_roleinfo> role2(String userid){
        return userGroupPrivilegeService.role2(userid);
    }

    //弹出框之后点保存
    @ApiOperation("分权限")
    @GetMapping("/roleinfo")
    public int roleinfo(int userid,String roleId){
        return userGroupPrivilegeService.roleinfo(userid,roleId);
    }
}
